package ma.zhiqiang.dataline;

import cn.hutool.core.io.FileUtil;
import cn.hutool.json.JSONUtil;
import ma.zhiqiang.dataline.config.JobConfig;
import ma.zhiqiang.dataline.core.engine.JobFactory;
import ma.zhiqiang.dataline.core.engine.Pipeline;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication
public class DatalineApplication {

	public static void main(String[] args) throws Exception{
		SpringApplication.run(DatalineApplication.class, args);
		if(null==args&&args.length==0){
			System.out.println("java -jar dataline.jar config.json");
		}
		String jsonString = FileUtil.readString(args[0],"UTF-8");
		JobConfig jobConfig = JSONUtil.toBean(jsonString, JobConfig.class);
		Pipeline pipeline = new JobFactory(jobConfig).getPipeline();
		pipeline.start();
	}

}
